'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {

    const { router, controller } = app;

    router.get( '/' , controller.home.index );
    router.get( '/security', controller.home.security_main);
    router.get( '/configdev',controller.home.configdev_main);

    router.get( '/api/v1/shops',    controller.protector.allShops );
    router.get( '/api/v1/protectors', controller.protector.allProtectors);
    router.get( '/api/v1/security/mqtt/serverInfo', controller.protector.mqttServerInfo );

    router.get( '/api/v1/security/shops',      controller.protector.shops);

    router.get( '/api/v1/security/protectors', controller.protector.protectors);

    router.put ('/api/v1/security/protectors', controller.protector.insertProtector);

    router.post( '/api/v1/security/shop', controller.protector.setShop );


    router.post( '/api/v1/security/alarmLog', controller.protector.processAlarmLog );
    router.put(  '/api/v1/security/alarmLog' , controller.protector.addAlarmLog );
    router.get(  '/api/v1/security/alarmLogs', controller.protector.getAlarmLogs );

    router.put( '/api/v1/security/operateLog', controller.protector.addOperateLog )
    router.get( '/api/v1/security/operateLogs', controller.protector.getOperateLogs );

    router.get( '/api/v1/security/areas', controller.protector.getAreas );

    // 登录校验
    router.post('/api/v1/login', controller.home.login);
}
